package com.emperor.employee.app;

import java.util.Map;

import org.apache.log4j.Logger;

import com.emperor.core.app.App;
import com.emperor.core.app.AppConstant;
import com.emperor.core.app.AppCtrl;

public class EmployeeAppCtrl implements AppCtrl {

	public static final String EMP_CTRL = "employee.ctrl";
	public static final String EMP_ENQ = "employee.enq";
	public static final String EMP_NEW = "employee.new";
	public static final String EMP_MGM = "employee.mgm";
	
	public static final String EMP_MSG = "employee.msg";
	public static final String EMP_ID = "employee.id";
	
	public static Logger log = Logger.getLogger(EmployeeAppCtrl.class);
	
	public void doProcess(Map<String, Object> params) {
		App app = null;
		if (params == null) {
			log.error("Param is null");
		} else if (params.get(AppConstant.ACTION).equals(EMP_NEW)) {
			app = new EmployeeAppNew(params);
		} else if (params.get(AppConstant.ACTION).equals(EMP_MGM)) {
			app = new EmployeeAppMgm(params);
		} else {
			app = new EmployeeAppEnq(params);
		}
		
		if (app != null)
			app.open();
	}

}
